Coverage Report

Created: 2026-04-21 11:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
D:\a\scloud-dns\scloud-dns\src\workers\reply_registry.rs
Line
Count
Source
1
use bytes::Bytes;
2
use dashmap::DashMap;
3
use once_cell::sync::Lazy;
4
use tokio::sync::oneshot;
5
use uuid::Uuid;
6
7
pub const REPLY_TAG_DOH: &str = "doh";
8
9
static REGISTRY: Lazy<DashMap<Uuid, oneshot::Sender<Bytes>>> = Lazy::new(DashMap::new);
10
11
0
pub fn register(task_id: Uuid) -> oneshot::Receiver<Bytes> {
12
0
    let (tx, rx) = oneshot::channel();
13
0
    REGISTRY.insert(task_id, tx);
14
0
    rx
15
0
}
16
17
0
pub fn take(task_id: &Uuid) -> Option<oneshot::Sender<Bytes>> {
18
0
    REGISTRY.remove(task_id).map(|(_, v)| v)
19
0
}
20
21
0
pub fn drop_entry(task_id: &Uuid) {
22
0
    REGISTRY.remove(task_id);
23
0
}